#pragma once
#include "mytypes.h"
#include "dynamics.h"
#include "RigidBody.h"

namespace poly
{
	// A Spring constraint
	// Connects two bodies using a linear damped spring
	class Spring : public IConstraint
	{
	public:
		Spring();

		void apply(float dt);
		RigidBody * rigidBody1;
		RigidBody * rigidBody2;
		float3 pointOfApp1; // in local coordinates
		float3 pointOfApp2; // in local coordinates

		float restLength;
		float forceDensity;
		float friction;
	};
}